package models

import (
	"time"
)

/*流程*/
type Flow struct {
	Id               string          `orm:"pk"`
	RowId            string          `orm:"column(row_id)"`
	ProjectVersionId *ProjectVersion `orm:"column(project_version_id);rel(fk)"`
	Deleted          int32           `orm:"column(deleted)"`
	Test             int32           `orm:"column(test)"`
	WebService       int32           `orm:"column(web_service)"`
	Name             string
	Notes            string  `orm:"column(notes);type(longtext)"`
	FolderId         *Folder `orm:"column(folder_id);rel(fk)"`

	CreateTime     time.Time       `orm:"column(create_time);type(datetime)"`
	CreateBy       string          `orm:"column(create_by)"`
	LastUpdateBy   string          `orm:"column(last_update_by)"`
	LastUpdateTime time.Time       `orm:"column(last_update_time);type(datetime)"`
	FlowSteps      []*FlowStep     `orm:"reverse(many)"` // fk 的反向关系
	FlowStepLinks  []*FlowStepLink `orm:"-"`
}

/*流程步骤*/
type FlowStep struct {
	Id               string     `orm:"pk"`
	ComponentId      *Component `orm:"column(component_id);rel(fk)"`
	FlowId           *Flow      `orm:"column(flow_id);rel(fk)"`
	X                int32
	Y                int32
	ApproximateOrder int32

	CreateTime     time.Time `orm:"column(create_time);type(datetime)"`
	CreateBy       string    `orm:"column(create_by)"`
	LastUpdateBy   string    `orm:"column(last_update_by)"`
	LastUpdateTime time.Time `orm:"column(last_update_time);type(datetime)"`

	Ui map[string]interface{} `orm:"-"`
}

/*流程链接*/
type FlowStepLink struct {
	SourceStepId   string
	TargetStepId   string
	CreateTime     time.Time `orm:"column(create_time);type(datetime)"`
	CreateBy       string    `orm:"column(create_by)"`
	LastUpdateBy   string    `orm:"column(last_update_by)"`
	LastUpdateTime time.Time `orm:"column(last_update_time);type(datetime)"`
}
